﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace PTA.NET
{
    public partial class Report : DevExpress.XtraEditors.XtraForm
    {
        public Report()
        {
            InitializeComponent();
        }

        private void Report_Load(object sender, EventArgs e)
        {
            //CreateData();
            
        }


        public void CreateData(string CustomerName, string GioiTinh, string SinhNam, MyData[] B1, MyData[] B2a, MyData[] B2b, MyData[] B3, MyData[] B4, MyData[] B5, MyData[] B6)
        {
            string Gioi_Tinh = GioiTinh.Equals("NAM") ? "Nam" : "Nữ";

            this.bindingB1.DataSource = B1;
            this.bindingB2a.DataSource = B2a;
            this.bindingB2b.DataSource = B2b;
            this.bindingB3.DataSource = B3;
            this.bindingB4.DataSource = B4;
            this.bindingB5.DataSource = B5;
            this.bindingB6.DataSource = B6;

            this.reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("CustomerName", CustomerName));
            this.reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("GioiTinh", Gioi_Tinh));
            this.reportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("SinhNam", SinhNam));

            this.reportViewer1.RefreshReport();     
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //Microsoft.Reporting.WinForms.ReportParameterInfoCollection Param = this.reportViewer1.LocalReport.GetParameters();

            Microsoft.Reporting.WinForms.RenderingExtension[] r = reportViewer1.LocalReport.ListRenderingExtensions();

            reportViewer1.ExportDialog(r[2]);
            //reportViewer1.


            
        }

        private void reportViewer1_Load(object sender, EventArgs e)
        {

        }

        private void Report_FormClosing(object sender, FormClosingEventArgs e)
        {
             reportViewer1.LocalReport.ReleaseSandboxAppDomain();
        }

        


       
    }
}